package com.guanyong.dao;

import com.guanyong.model.FilmModel;
import com.guanyong.model.MerchantLogModel;
import com.guanyong.model.MerchantModel;
import org.apache.ibatis.annotations.*;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by mxk on 2017/6/1.
 */
public interface IMerchantLogDaoMapper {
    @Select("SELECT * FROM t_ad_merchantlog  where f_id=#{fId}")
    @ResultMap("MerchantLogResultMap")
    MerchantLogModel selectByPrimaryKey(String fId);

    @Insert("insert t_ad_merchantlog (ak,url,ip,serverip,username,objectid) " +
            "values(#{merchantLogModel.ak},#{merchantLogModel.url},#{merchantLogModel.ip}," +
            "#{merchantLogModel.serverIp},#{merchantLogModel.userName}," +
            "#{merchantLogModel.objectId})")
    int addMerchantlog(@Param(value = "merchantLogModel") MerchantLogModel merchantLogModel);


    List<MerchantModel> SelectMerchantLogList(@Param("ak") String ak,
                                              @Param("btime") String btime,
                                              @Param("etime") String etime,
                                              @Param("name") String name,
                                           @Param("offset") Integer offset,
                                           @Param("limit") Integer limit);


    Integer SelectMerchantLogListCount(@Param("ak") String ak,
                                       @Param("btime") String btime,
                                       @Param("etime") String etime,
                                       @Param("name") String name);


    List<HashMap<String,Integer>> getAllCount(@Param("ak") String ak,
                                              @Param("btime") String btime,
                                              @Param("etime") String etime,
                                              @Param("name") String name);

    //一下代码为 统计

    //按照年份分组


    List<HashMap<Integer, Integer>>  GetResultGourpByYear( @Param("akid") String  akid);



    List<HashMap<String, Integer>>  GetResultGourpByObjectid( @Param("akid") String  akid);


    List<HashMap<String, Integer>>  GetResultGourpByTimeDay( @Param("akid") String  akid,
                                                             @Param("btime") String  btime,
                                                             @Param("etime") String  etime);
}
